var cVideo = function (obj) {
    var $obj = $(obj);
    var id = $obj.attr('id');
    var value = $obj.val();
    if (!confirm('upload '+value+' ?')){
        $obj.val('');
        return false;
    }
    var extension = /\.(flv)$/i.exec(value);
    if (!extension) {
        alert('extension must is .flv.');
        return false;
    }

    $.ajaxFileUpload({
        url:'/cvideo/',
        async: true,
        fileElementId: id,
        dataType: 'json',
        success: function (json) {
            $('#file').val('');
            if (json['status'] != true){
                alert(json['message']);
                return false;
            } else {
                window.location = './' + json['id'] + '/';
            }
        },
        error: function (json, status, e) {
            var msg = '';
            for (var k in json) {
                msg += k + ':' + json[k] + ',';
            }
            var content = 'ajaxFileUpload: '+ status + ', ' + e + ': ' + msg;
            var $ajaxError = $('<div id="ajaxError">'+content+'</div>');
            $('body').append($ajaxError);
            $ajaxError.dialog({
                title: '',
                //modal: true,
                //overlay: {opacity: 0.8, background: "black"},
                buttons: {
                    'close': function(){
                        $ajaxError.dialog('close');
                    }
                },
                width: 950,
                height: 550
            });
            return false;
        }
    });
    return false;
}